(deftemplate number(slot pi)(slot pz)) ;pi=parte intreaga, pz=parte zecimala
(assert (number (pi 1)(pz 0)))
(assert (number (pi 2)(pz 3)))
(assert (number (pi 5)(pz 12)))
(assert (number (pi 6)(pz 1234)))

(defrule printare
    ( number (pi ?i)(pz ?z))
    
    =>
    (printout t "Numarul are partea intreaga " ?i " si partea fractionara " ?z crlf)
    
    )
(deftemplate suma(slot pi)(slot pz)) ;pi=parte intreaga, pz=parte zecimala
(assert (suma (pi 0)(pz 0)))

(defrule adunaIntreg
    ?idfapt2<-( number (pi ?i))
    ?idfapt<-(suma(pi ?s))
    
    =>
    (bind ?s1 (+ ?s ?i))
    (modify ?idfapt (pi ?s1))
    (retract ?idfapt2)
    ;(printout t ?s1 crlf)

)
(defrule print
    ( suma (pi ?s))
    
    =>
    (printout t "suma este " ?s crlf)
    
    )
(run)
